package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.BladeApplyConMapper;
import com.ruoyi.consume.domain.BladeApplyCon;
import com.ruoyi.consume.service.IBladeApplyConService;

/**
 * 刀片领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-23
 */
@Service
public class BladeApplyConServiceImpl implements IBladeApplyConService
{
    @Autowired
    private BladeApplyConMapper bladeApplyConMapper;

    /**
     * 查询刀片领用
     *
     * @param bladeApplyId 刀片领用ID
     * @return 刀片领用
     */
    @Override
    public BladeApplyCon selectBladeApplyById(Long bladeApplyId)
    {
        return bladeApplyConMapper.selectBladeApplyById(bladeApplyId);
    }

    /**
     * 查询刀片领用列表
     *
     * @param bladeApplyCon 刀片领用
     * @return 刀片领用
     */
    @Override
    public List<BladeApplyCon> selectBladeApplyList(BladeApplyCon bladeApplyCon)
    {
        return bladeApplyConMapper.selectBladeApplyList(bladeApplyCon);
    }

    /**
     * 新增刀片领用
     *
     * @param bladeApplyCon 刀片领用
     * @return 结果
     */
    @Override
    public int insertBladeApply(BladeApplyCon bladeApplyCon)
    {
        bladeApplyCon.setCreateTime(DateUtils.getNowDate());
        return bladeApplyConMapper.insertBladeApply(bladeApplyCon);
    }

    /**
     * 修改刀片领用
     *
     * @param bladeApplyCon 刀片领用
     * @return 结果
     */
    @Override
    public int updateBladeApply(BladeApplyCon bladeApplyCon)
    {
        bladeApplyCon.setUpdateTime(DateUtils.getNowDate());
        return bladeApplyConMapper.updateBladeApply(bladeApplyCon);
    }

    /**
     * 批量删除刀片领用
     *
     * @param bladeApplyIds 需要删除的刀片领用ID
     * @return 结果
     */
    @Override
    public int deleteBladeApplyByIds(Long[] bladeApplyIds)
    {
        return bladeApplyConMapper.deleteBladeApplyByIds(bladeApplyIds);
    }

    /**
     * 删除刀片领用信息
     *
     * @param bladeApplyId 刀片领用ID
     * @return 结果
     */
    @Override
    public int deleteBladeApplyById(Long bladeApplyId)
    {
        return bladeApplyConMapper.deleteBladeApplyById(bladeApplyId);
    }

    /**
     * 更新库存量表
     *
     * @param bladeApplyCon 刀片领用ID
     * @return 结果
     */
    @Override
    public int updateBladeAmount(BladeApplyCon bladeApplyCon){
        return bladeApplyConMapper.updateBladeAmount(bladeApplyCon);
    }

    /**
     * 更新领用状态
     *
     * @param bladeApplyId 刀片领用ID
     * @return 结果
     */
    @Override
    public int updateConsumeStatus(Long bladeApplyId){
        return bladeApplyConMapper.updateConsumeStatus(bladeApplyId);
    }

    /**
     * 退回操作
     *
     * @param bladeApplyId 刀片领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long bladeApplyId){
        return bladeApplyConMapper.updateApprovalStatus(bladeApplyId);
    }
}
